{% extends "page.html" %}
{% block title %}{{ this.title }}{% endblock %}

{% block htmlheader %}
<script type="text/javascript">
// Sets the display style of all currently selected dictionaries to BLOCK, and
// all others to NONE.
function showDictionaries(e, platform) {
    // Get the currently selected language from the SELECT object in the body
    // (the function is called from there, with 'e' as the argument)
    var selectedLang = e.options[e.selectedIndex].value;
    // Query all elements that are marked with the dict-entry class name
    var allEntries = document.querySelectorAll('.' + platform);

    var cnt;
    for (cnt = 0; cnt < allEntries.length; cnt++) {
        // Set display to block or none based on whether the element is marked
        // with a class name dict-(src|trg)-eng, dict-(src|trg)-deu, ... depending on the
        // selected language
        var clname = allEntries[cnt].className.split(' ');
        if(clname.includes("dict-src-" + selectedLang) ||
                clname.includes("dict-trg-" + selectedLang)) {

            allEntries[cnt].style.display = "block";
        } else {
            allEntries[cnt].style.display = "none";
        }
    }
}
</script>
<noscript>{{ _("This page uses JavaScript to nicely format the list of downloads.  You will instead see a lengthy list, since your browser has JavaScript disabled or doesn't include support for it.") }}</noscript>
{% endblock %}

{% block body %}
<h2>{{ _("Table Of Contents") }}</h2>
<ul class="toc">
    {% for item in this.body.toc + this.after_mobile.toc + this.after_desktop.toc + this.after_source.toc recursive %}
      <li><a href="#{{ item.anchor }}">{{ item.title }}</a>{%
             if item.children %}<ul>{{ loop(item.children) }}</ul>{% endif
             %}</li>
      {% endfor %}
</ul>

  {{ super() }}

{{ generate_download_section('stardict') }}

{% block after_stardict %} {{ this.after_stardict }} {% endblock %}

{{ generate_download_section('slob') }}

{% block after_mobile %} {{ this.after_mobile }} {% endblock %}

{{ generate_download_section('dictd') }}

{% block after_desktop %} {{ this.after_desktop }} {% endblock %}

{{ generate_download_section('src') }}

{% block after_source %} {{ this.after_source }} {% endblock %}
<script>
// Query all elements that are marked with the dict-entry class name and set to
// invisible
var allEntries = document.querySelectorAll('.downloaditem')
var cnt;
for (cnt = 0; cnt < allEntries.length; cnt++) {
  allEntries[cnt].style.display = "none";
}
</script>
{% endblock %}
